package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("findAll")
    public List<User> getUser(){
       return userService.findAll();

    }
    @DeleteMapping("/user/{id}")
    public String deleteById(@PathVariable Integer id){
        userService.deleteById(id);
        return id+"删除成功！！！";
    }
    @PostMapping("SaveUser")
    public String SaveUser(@RequestBody User user){
        userService.SaveUser(user);
        return "新增成功~~";
    }
    @PostMapping("updateUser")
    public void f(@RequestBody User user){
        userService.f(user);
    }
}
